<!DOCTYPE html>
<html lang="en">
	<head>
		<meta charset="utf-8" />

		<!-- Always force latest IE rendering engine (even in intranet) & Chrome Frame
		Remove this if you use the .htaccess -->
		<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
		<title>Test of DBGraph library</title>
		<meta name="description" content="Test of DBGraph library" />
		<meta name="author" content="aferroni" />
		<meta name="viewport" content="width=device-width; initial-scale=1.0" />
        <script src="raphael-min.js" ></script>
        <script src="dbgraph.js" ></script>
        <script>
        
           //Code execute on page load 
           window.onload = function () {

             //Schema object creation 
             MySchema = new DBSchema("Example schema DataBase","canvas");
			 
			 //Base settings of schema 
			 MySchema.font = "Tahoma";
		     MySchema.fontSize = "10";
		     
		     //MySchema.hideRelationFieldName = ""; //Render all relation line
		     
		     //MySchema.hideRelationFieldName = "_AZN"; //Line relation based on field name like _ANZ are not rendered 
		                  
             //Create entity Forniture
           	 var Forniture = MySchema.newEntity("BILL","FORNITURE","Tabella delle forniture",100,20);
           	 Forniture.addField("FORN_AZN","VARCHAR2(2)","Azienda");
             Forniture.addField("FORN_PUNTOPRESA","NUMBER(10)","Identificativo fornitura");
           	 Forniture.addField("FORN_CODSER","NUMBER(2)","Tipo servizio");
           	 Forniture.addField("FORN_CODANA","NUMBER(2)","Codice Anagrafico");

             //Create entity TipiForniture
           	 var TipiForniture = MySchema.newEntity("BILL","TIPIFORNITURE","Tabella dei Tipi forniture",300,20);
           	 TipiForniture.addField("TFORN_AZN","VARCHAR2(2)","Azienda");
           	 TipiForniture.addField("TFORN_CODSER","NUMBER(2)","Identificativo Tipo fornitura");

             //Create entity Anagrafiche
           	 var Anagrafiche = MySchema.newEntity("BILL","ANAGRAFICHE","Tabella delle anagrafiche",500,20);
           	 Anagrafiche.addField("ANAG_AZN","VARCHAR2(2)","Azienda");
           	 Anagrafiche.addField("ANAG_CODANA","NUMBER(2)","Identificativo anagrafica");

             //Create relation 
             MySchema.newRelation("FORNITURE-TIPIFORNITURE","Relazione tra FORNITURE e TIPIFORNITURE","FORNITURE","TIPIFORNITURE")
             //Specify fields of relation 
             .addField("FORN_AZN" ,"TFORN_AZN" )
             .addField("FORN_CODSER","TFORN_CODSER");

             //Create relation
             MySchema.newRelation("FORNITURE-ANAGRAFICHE","Relazione tra Forniture e Anagrafiche","FORNITURE","ANAGRAFICHE")
             //Specify fields of relation 
	         .addField("FORN_AZN"   ,"ANAG_AZN"   )
	         .addField("FORN_CODANA","ANAG_CODANA");

             //Just a test Create auto-relation
             /*MySchema.newRelation("FORNITURE-FORNITURE","Relazione tra Forniture e Forniture","FORNITURE","FORNITURE")
             //Specify fields of relation 
	         .addField("FORN_PUNTOPRESA"   ,"FORN_CODSER"   )
             //Wrong draw and and wrong move
             */
                        
             //Render schema
             MySchema.render();
             
             //Test for autodispose
             //Mymove work but at next drag mouse coords are not clear
             //MySchema.entities[1].mymove(0,100);
             
           }

        </script>
	</head>
	<body>
      <!--div id="title" style="border:1px solid black;"><center>SIU</center></div-->	   
      <div id="canvas" style="border:1px solid black; overflow:scroll"></div>	   
	   <!--div id="note">
	   <li>Optimize relation line render</li>
	   <li>review class diagram</li>
	   <li>optmize status bar to show table and field description</li>
	   <li>Switch relation position EST/OVEST </li>
	   
	   <li>Autosize height by bbox text percentage value</li>
	   
	   <li>Different color for selected relation</li>
	   
	   <li>Autorelation FROM TO are same entity</li>
	   
	   <li>Scrollbar</li>
	   
	   <li>Autodispose</li>
	   
	   <li>Optimize access of array using associative array</li>
	   	   
	   <li>Relation direction</li>
	   <li>Relation cardinality</li>
	   <li>hover path relation</li>
	   	   
	   <li>No fields mode and singole line relation, name relation, cardinality and arrow </li>
	   </div-->
	</body>
</html>
